package org.dromara.visitor.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.dromara.visitor.domain.dto.ApplyAndVisitMonthResp;
import org.dromara.visitor.domain.entity.Apply;

import java.time.LocalDateTime;
import java.util.List;

public interface ApplyMapper extends BaseMapper<Apply> {
    @Select("select date_format(va.create_time, '%Y-%m') as monthValue ,count(id) as count from vis_apply va where va.create_time between #{startTime} and #{endTime}" +
        "group by month(create_time) order by create_time")
    List<ApplyAndVisitMonthResp> applyAndVisitMonthList(@Param("startTime") LocalDateTime startTime,@Param("endTime") LocalDateTime endTime);
}
